package com.kern.jpademo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.List;

/**
 * Created by caoshi at 7:12 2021-08-01
 */
@Data
@Entity
@Table(name = "t_author")
public class XAuthor {

    @Id
    @Column(name = "id")
    private String id;

    @Column(name = "name")
    private String name;

    @Column(name = "salary")
    private Double salary;

    @Column(name = "info")
    private String info;

    public XAuthor() {
    }

    public XAuthor(String id, String name, Double salary, String info) {
        this.id = id;
        this.name = name;
        this.salary = salary;
        this.info = info;
    }

    @OneToMany(mappedBy = "authorId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    private List<XBook> bookList;

}
